Bug 6588239

Bug Description:

This is a deadlock bug.
The following is an example of deadlock thread dump:

"Thread-1": waiting to lock monitor 0x0000000005edd9a8 (object 0x00000000102df3d8,
   a java.lang.Class), which is held by "Thread-0"
"Thread-0": waiting to lock monitor 0x0000000005edda50 (object 0x00000000102e10d0, 
   a java.lang.Class), which is held by "Thread-1"

Java stack information for the threads listed above:
===================================================
"Thread-1":
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3069)
    - waiting to lock <0x00000000102df3d8> (a java.lang.Class for Test)
    at java.lang.Class.getAnnotation(Class.java:3029)
    at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:113)
    at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
    - locked <0x00000000102e10d0> (a java.lang.Class for sun.reflect.annotation.AnnotationType)
    at Test6588239$Thread2.run(Test6588239.java:42)
"Thread-0":
    at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:63)
    - waiting to lock <0x00000000102e10d0> (a java.lang.Class for sun.reflect.annotation.AnnotationType)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3072)
    - locked <0x00000000102df3d8> (a java.lang.Class for Test)
    at java.lang.Class.getAnnotations(Class.java:3052)
    at Test6588239$Thread1.run(Test6588239.java:24)
	
More details about this bug are at JDK-6588239 JIRA page.

How To Reproduce:

This bug is reproduced under JDK 1.6.0.
It has not been fixed.
Execute the following scripts to run the test to reproduce the bug (assume the location of the jdk6 test project is jdk_test_home).

Linux:
${jdk_test_home}/scripts/6588239.sh [--monitoroff] [--javaloc path]
Windows:
%jdk_test_home%\scripts\6588239.bat [--monitoroff] [--javaloc path]

Example:
Use monitor to report and terminate the program when deadlock happens:
${jdk_test_home}/scripts/6588239.sh

Turn off monitor:
${jdk_test_home}/scripts/6588239.sh --monitoroff

Option Function
--monitoroff, -mo Turn off to stop reporting bug messages and ending program when the test runs into the expected concurrency bug which is a deadlock.
User has to terminate the program manually when this option is set.
--javaloc The location of JDK that is eligible to reproduce the bug, if your java environment is not eligible.
In this case, it's JDK 1.6.0. It should be the absolute path to the JDK's java starter and ended with "/".
For example: ~/jdk/home/jdk1.6.0/bin/